package com.terracloud.server.service.entitiy.role;

import com.terracloud.server.common.data.Role;
import com.terracloud.server.common.data.exception.ThingsboardException;
import com.terracloud.server.common.data.id.TenantId;
import com.terracloud.server.common.data.page.PageData;
import com.terracloud.server.service.security.model.SecurityUser;

import java.util.Set;
import java.util.UUID;

/**
 *
 * @author chenhainan
 * @since 2025/10/20
 */
public interface RoleService {

    String SYS_ADMIN_ROLE = "系统管理员";

    Set<String> SYS_ADMIN_MENUS = Set.of("Thingdboard", "TbHome", "Tenant", "TenantList",
            "TenantAdminList", "TenantProfileList", "Notification", "NotificationIndex", "NotificationList", "NotificationRequestList",
            "NotificationRecipientList", "NotificationTemplateList", "NotificationRuleList", "AdminSetting", "AdminSettingIndex",
            "TenantManagement", "TenantGroupList",
            "OpsMonitoringRelease", "OpsMonitoringRegistry", "OpsMonitoringSystem", "OpsMonitoringDashboard", "OpsMonitoring", "OpsMonitoringService");

    String TENANT_ADMIN_ROLE = "租户管理员";

    Set<String> TENANT_ADMIN_MENUS = Set.of(
            "Thingdboard",
            "TbHome",
            "AlarmList",
            "Dashboard",
            "DashboardList",
            "DashboardEditor",
            "Device",
            "DeviceList",
            "ProductList",
            "GroupList",
            "AssetList",
            "EntityViewList",
            "Profile",
            "ProfileIndex",
            "AssetProfileList",
            "DeviceProfileList",
            "RuleChain",
            "RuleChainList",
            "RuleChainDetail",
            "OtaPackage",
            "Notification",
            "NotificationIndex",
            "NotificationList",
            "NotificationRequestList",
            "NotificationRecipientList",
            "NotificationTemplateList",
            "NotificationRuleList",
            "AdminSetting",
            "AdminSettingIndex",
            "AuditLog",
            "Customer",
            "CustomerUserList",
            "Role",
            "RoleList",
            "OpsMonitoringRelease", "OpsMonitoringRegistry", "OpsMonitoringSystem", "OpsMonitoringDashboard", "OpsMonitoring", "OpsMonitoringService"
    );

    PageData<Role> getRoles(TenantId tenantId, int page, int pageSize, String textSearch);

    Role saveRole(Role role, SecurityUser currentUser);

    Role getRoleInfo(SecurityUser currentUser, UUID roleId);

    Role findRoleByName(TenantId tenantId, String roleName);

    Role findUserRole(UUID userId) throws Throwable;

    void deleteRole(SecurityUser currentUser, UUID roleId) throws ThingsboardException;
}
